package com.publishproject.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.publishproject.R;
import com.wx.wheelview.adapter.ArrayWheelAdapter;
import com.wx.wheelview.widget.WheelView;

import java.util.Arrays;
import java.util.List;

import pushlish.tang.com.commonutils.ToastUtils;

public class WheelActivity extends AppCompatActivity {

    private WheelView wheel1,wheel2;
    private List<String> arrays = Arrays.asList("1","2","3","5","5","7","8","9");

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wheel);
        wheel1 = (WheelView)findViewById(R.id.wheel1);
        wheel2 = (WheelView)findViewById(R.id.wheel2);
        wheel1.setSkin(WheelView.Skin.Common);
        wheel1.setWheelAdapter(new ArrayWheelAdapter(this));
        wheel1.setWheelData(arrays);
        wheel1.setWheelSize(3);
        wheel1.setOnWheelItemClickListener(new WheelView.OnWheelItemClickListener() {
            @Override
            public void onItemClick(int position, Object o) {
                ToastUtils.showMessage(WheelActivity.this,o.toString()+"   被点击了");
            }
        });

        wheel2.setSkin(WheelView.Skin.Holo);
        wheel2.setWheelAdapter(new ArrayWheelAdapter(this));
        wheel2.setWheelData(arrays);
        wheel2.setWheelSize(5);
        wheel2.setOnWheelItemClickListener(new WheelView.OnWheelItemClickListener() {
            @Override
            public void onItemClick(int position, Object o) {
                ToastUtils.showMessage(WheelActivity.this,o.toString()+"   被点击了");
            }
        });
        wheel2.setLoop(true);

    }
}
